home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol218 / printmar.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1986-11-30  |  4.4 KB  |  165 lines

  1. 100  REM PRINTMAR Program.
  2. 110  REM Prints Detailed Marriage Information
  3. 120  REM By:  Melvin O. Duke.  Last Updated 17 February 1986.
  4. 200  REM Screen Definitions
  5. 210  WIDTH "scrn:", 80
  6. 220  SCREEN S1,S2,S3,S4
  7. 600  REM Titles
  8. 610  TITLE$ = "Print the Marriages File"
  9. 620  TITLE$ = TITLE$ + " ON DISPLAY"
  10. 700  REM Terminate if not called from the Menu
  11. 710  IF DD.MENU$ <> "" THEN 770
  12. 720  COLOR 7,0 : KEY ON : CLS : LOCATE 15,1
  13. 730  PRINT "Cannot run the"
  14. 740  PRINT TITLE$
  15. 750  PRINT "Program, unless selected from the MENU"
  16. 760  END
  17. 770  REM OK
  18. 1000  REM Produce the first screen
  19. 1010  KEY ON : CLS : KEY OFF
  20. 1020  REM Draw the outer double box
  21. 1030  R1 = 1 : C1 = 1 : R2 = 24 : C2 = 79 : GOSUB 1300
  22. 1040  REM Find the title location
  23. 1050  TITLE.POS = 40 - INT(LEN(TITLE$)/2)
  24. 1060  REM Draw the title box
  25. 1070  R1=3:C1=TITLE.POS-2:R2=6:C2=TITLE.POS+LEN(TITLE$)+1:GOSUB 1500
  26. 1080  REM Print the title
  27. 1090  LOCATE 4,TITLE.POS : PRINT TITLE$
  28. 1100  LOCATE 5,40-INT(LEN(VERSION$)/2) :  PRINT VERSION$;
  29. 1230  REM Draw the Copyright box
  30. 1240  R1 = 19 : C1 = 21 : R2 = 22 : C2 = 59 : GOSUB 1300
  31. 1250  REM Print the Copyright
  32. 1260  LOCATE 20,40-INT(LEN(COPY1$)/2) :  PRINT COPY1$;
  33. 1270  LOCATE 21,40-INT(LEN(COPY2$)/2) :  PRINT COPY2$;
  34. 1280  GOTO 1700
  35. 1300  REM subroutine to print a double box
  36. 1310  COLOR P
  37. 1320  FOR I = R1 + 1 TO R2 - 1
  38. 1330   LOCATE I, C1 : PRINT CHR$(186);
  39. 1340   LOCATE I, C2 : PRINT CHR$(186);
  40. 1350  NEXT I
  41. 1360  FOR J = C1 + 1 TO C2 - 1
  42. 1370   LOCATE R1, J : PRINT CHR$(205);
  43. 1380   LOCATE R2, J : PRINT CHR$(205);
  44. 1390  NEXT J
  45. 1400   LOCATE R1, C1 : PRINT CHR$(201);
  46. 1410   LOCATE R1, C2 : PRINT CHR$(187);
  47. 1420   LOCATE R2, C1 : PRINT CHR$(200);
  48. 1430   LOCATE R2, C2 : PRINT CHR$(188);
  49. 1440  COLOR W
  50. 1450  RETURN
  51. 1500  REM subroutine to print a single box
  52. 1510  COLOR B
  53. 1520  FOR I = R1 + 1 TO R2 - 1
  54. 1530   LOCATE I, C1 : PRINT CHR$(179);
  55. 1540   LOCATE I, C2 : PRINT CHR$(179);
  56. 1550  NEXT I
  57. 1560  FOR J = C1 + 1 TO C2 - 1
  58. 1570   LOCATE R1, J : PRINT CHR$(196);
  59. 1580   LOCATE R2, J : PRINT CHR$(196);
  60. 1590  NEXT J
  61. 1600   LOCATE R1, C1 : PRINT CHR$(218);
  62. 1610   LOCATE R1, C2 : PRINT CHR$(191);
  63. 1620   LOCATE R2, C1 : PRINT CHR$(192);
  64. 1630   LOCATE R2, C2 : PRINT CHR$(217);
  65. 1640  COLOR W
  66. 1650  RETURN
  67. 1700  REM ask user to press a key to continue
  68. 1710  LOCATE 25,1
  69. 1720  PRINT "Have Data Diskette(s) in Place, then Press any key to continue.";
  70. 1730  K$ = INKEY$ : IF K$ = "" THEN 1730
  71. 1740  KEY ON : CLS : KEY OFF
  72. 2000  REM PRINTMAR Program Starts Here
  73. 2010  OPEN DD.PERS$+"persfile" AS #1 LEN = 256
  74. 2020  FIELD 1, 5 AS F1$, 20 AS F2$, 30 AS F3$, 2 AS F4$, 5 AS F5$, 5 AS F6$, 5 AS F7$, 11 AS F8$, 18 AS F9$, 16 AS F10$, 16 AS F11$, 11 AS F12$, 18 AS F13$, 16 AS F14$, 16 AS F15$, 11 AS F16$, 18 AS F17$, 16 AS F18$, 16 AS F19$
  75. 2030  OPEN DD.MARR$+"marrfile" AS #2 LEN = 128
  76. 2040  FIELD 2, 5 AS M1$, 5 AS M2$, 5 AS M3$, 5 AS M4$, 11 AS M5$, 18 AS M6$, 16 AS M7$, 16 AS M8$, 45 AS M9$
  77. 2050  REM Determine User Wants
  78. 2060  KEY ON : CLS : KEY OFF : LOCATE 21,1
  79. 2070  INPUT "Enter the Marriage Number to be Printed (0 to quit), or 'all'"; REPLY$
  80. 2080  IF REPLY$ = "0" THEN 2870
  81. 2090  K = 0
  82. 2100  GOTO 2150
  83. 2110  LPRINT TAB(10);"Print-out of Contents of the Marriages File"
  84. 2120  LPRINT TAB(10);DATE$,TIME$
  85. 2130  LPRINT
  86. 2140  RETURN
  87. 2150  IF LEFT$(REPLY$,1) = "a" OR LEFT$(REPLY$,1) = "A" THEN 2210
  88. 2160  K = 4
  89. 2170  I = VAL(REPLY$)
  90. 2180  IF I < 1 OR I > MAX.MAR THEN KEY ON : CLS : KEY OFF : LOCATE 20,1 : PRINT "Number is out of range"; : GOTO 2070
  91. 2190  GOSUB 2110
  92. 2200  GOSUB 2260 : GOTO 2060
  93. 2210  REM Read all records, and print the actual ones
  94. 2220  FOR I = 1 TO MAX.MAR
  95. 2230  LOCATE 22,1 : PRINT "Processing Record";I;
  96. 2240  GOSUB 2260
  97. 2250  GOTO 2800
  98. 2260  GET #2, I
  99. 2270  REM Extract information from the file for use
  100. 2280  T1 = CVS(M1$)
  101. 2290  IF T1 < 1 THEN 2790
  102. 2300  K = K + 1
  103. 2310  IF K MOD 5 = 1 THEN GOSUB 2110
  104. 2320  T2 = CVS(M2$)
  105. 2330  T3 = CVS(M3$)
  106. 2340  T4 = CVS(M4$)
  107. 2350  T5$ = M5$
  108. 2360  T6$ = M6$
  109. 2370  T7$ = M7$
  110. 2380  T8$ = M8$
  111. 2390  T9$ = M9$
  112. 2400  REM obtain the name of the husband
  113. 2410  GET #1, T2
  114. 2420  REM obtain the last and given names
  115. 2430  TEMP$ = F2$ 'Husband`s last name
  116. 2440  TMP$ = F2$
  117. 2450  GOSUB 2820
  118. 2460  TT2$ = TMP$
  119. 2470  TEMP$ = F3$ 'Husband's given names
  120. 2480  TMP$ = F3$
  121. 2490  GOSUB 2820
  122. 2500  TT3$ = TMP$
  123. 2510  REM obtain the name of the wife
  124. 2520  GET #1, T3
  125. 2530  REM obtain the last and given names
  126. 2540  TEMP$ = F2$ 'Wife`s last name
  127. 2550  TMP$ = F2$
  128. 2560  GOSUB 2820
  129. 2570  TT4$ = TMP$
  130. 2580  TEMP$ = F3$ 'Wife's given names
  131. 2590  TMP$ = F3$
  132. 2600  GOSUB 2820
  133. 2610  TT5$ = TMP$
  134. 2620  REM Now Print the Information
  135. 2630  LPRINT TAB(10);"Marriage Record-number : ";
  136. 2640  LPRINT USING "###"; T1
  137. 2650  LPRINT TAB(10);"Husband's Record Number: ";
  138. 2660  LPRINT USING "###"; T2;
  139. 2670  LPRINT TAB(42); LEFT$(TT2$+", "+TT3$,37)
  140. 2680  LPRINT TAB(10);"Wife`s Record Number   : ";
  141. 2690  LPRINT USING "###"; T3;
  142. 2700  LPRINT TAB(42); LEFT$(TT4$+", "+TT5$,37)
  143. 2710  LPRINT TAB(10);"Marriage-date          : ";T5$
  144. 2720  LPRINT TAB(10);"Marriage-city          : ";T6$
  145. 2730  LPRINT TAB(10);"Marriage-county        : ";T7$
  146. 2740  LPRINT TAB(10);"Marriage-state         : ";T8$
  147. 2750  LPRINT TAB(10);"Comments: ";T9$
  148. 2760  LPRINT
  149. 2770  LPRINT : LPRINT
  150. 2780  IF K MOD 5 = 0 THEN LPRINT FORM.FEED$;
  151. 2790  RETURN
  152. 2800  NEXT I
  153. 2810  GOTO 2870
  154. 2820  REM rtrim$ subroutine
  155. 2830  FOR J = 1 TO LEN(TEMP$)-1
  156. 2840   IF RIGHT$(TMP$,1)=" " THEN TMP$ = LEFT$(TMP$,LEN(TMP$)-1) ELSE J = LEN(TEMP$)-1
  157. 2850  NEXT J
  158. 2860  RETURN
  159. 2870  CLOSE #1
  160. 2880  KEY ON : CLS : KEY OFF : LOCATE 21,1
  161. 2890  PRINT "End of Program"
  162. 2900  IF LEFT$(REPLY$,1) = "a" OR LEFT$(REPLY$,1) = "A" THEN 2910 ELSE 2920
  163. 2910  LPRINT FORM.FEED$;
  164. 2920  RUN DD.MENU$+"menu"
  165.